<div class="list-no-data" *ngIf="!conversationList || conversationList.length === 0">暂无联系人</div>
<perfect-scrollbar class="conversation-container">
    <ul class="conversation-list">
        <li *ngFor="let item of conversationList;let i = index;" (contextmenu)="contextmenu($event, item)" (click)="selectTarget(item)" [ngClass]="{'active': (active.type === 4 && (item.key == active.key || item.gid == active.key)) || (active.type === 3 && (item.name == active.name)), 'isTop': item?.extras?.top_time_ms}" class="display-flex">
            <div class="conversation-avatar">
                <div>
                    <img *ngIf="item.type == 3" avatarLoad [avatarError]="3" [src]="item.avatarUrl" alt="">
                    <img *ngIf="item.type == 4" avatarLoad [avatarError]="4" [src]="item.avatarUrl" alt="">
                </div>
                <jui-badge *ngIf="item.unreadNum && !item.noDisturb" class="conversation-badge" displayType="no-wrapper" [badgeNum]="item.unreadNum" showZero="false" maxNum="100"></jui-badge>
                <span *ngIf="item.unreadNum && item.noDisturb" class="conversation-dot"></span>
            </div>
            <div class="flex-1">
                <div class="display-flex">
                    <p class="conversation-nickname flex-1">{{item.memo_name || item.nickName || item.name}}</p>
                    <p class="conversation-time" *ngIf="item.recentMsg" [ngSwitch]="item?.recentMsg.conversation_time_show">
                        <time *ngSwitchCase="'year'">{{item.recentMsg.ctime_ms | time:"yy-MM-dd"}}</time>
                        <time *ngSwitchCase="'month'">{{item.recentMsg.ctime_ms | time:"MM-dd"}}</time>
                        <time *ngSwitchCase="'day'">{{item.recentMsg.ctime_ms | day}}</time>
                        <time *ngSwitchCase="'the day before'">前天</time>
                        <time *ngSwitchCase="'yesterday'">昨天</time>
                        <time *ngSwitchCase="'today'">{{item.recentMsg.ctime_ms | time:"HH:mm"}}</time>
                    </p>
                </div>
                <p class="conversation-recentMsg" *ngIf="item?.recentMsg?.content?.msg_type && !item.draft" [ngSwitch]="item?.recentMsg?.content?.msg_type">
                    <span class="conversation-at" *ngIf="item.atUser">[{{item.atUser}}]</span>
                    <span [ngClass]="{'conversation-unread-text': item.recentMsg.unread_count}" *ngIf="item.recentMsg.msg_type === 3 && item.recentMsg.content.from_id === global.user && ((item.recentMsg.success && item.recentMsg.success === 2) || !item.recentMsg.success)">{{item.recentMsg.unread_count ? '[未读]' : '[已读]'}}</span>
                    <span *ngIf="item.recentMsg.msg_type === 4 && item.recentMsg.content.msg_type !== 'event'">{{item.recentMsg.content.from_id === global.user ? '我' : (item.recentMsg.content.memo_name || item.recentMsg.content.from_name || item.recentMsg.content.from_id)}}&nbsp;:&nbsp;</span>
                    <span class="conversation-send-error" *ngIf="item.recentMsg.success === 3"></span>
                    <span *ngSwitchCase="'text'" [innerHTML]="item.recentMsg.content.msg_body.text | emoji: {nbsp: true, href: false, fontSize: 18}"></span>
                    <span *ngIf="item.recentMsg.content.msg_type === 'image' && item.recentMsg.content.msg_body?.extras?.kLargeEmoticon !== 'kLargeEmoticon'">[图片]</span>
                    <span *ngIf="item.recentMsg.content.msg_type === 'image' && item.recentMsg.content.msg_body?.extras?.kLargeEmoticon === 'kLargeEmoticon'">[表情]</span>
                    <span *ngIf="item.recentMsg.content.msg_type === 'file' && !item.recentMsg.content.msg_body?.extras?.video">[文件]</span>
                    <span *ngIf="item.recentMsg.content.msg_type === 'file' && item.recentMsg.content.msg_body?.extras?.video">[视频]</span>
                    <span *ngSwitchCase="'video'">[视频]</span>                    
                    <span *ngSwitchCase="'voice'">[语音]</span>
                    <span *ngSwitchCase="'location'">[位置]</span>
                    <span *ngSwitchCase="'event'">{{item.recentMsg.content.msg_body.text}}</span>
                </p>
                <p class="conversation-draft" *ngIf="item.draft"><span class="float-left conversation-draft-text">[草稿] </span><span class="float-left conversation-draft-msg" [innerHTML]="item.draft"></span></p>
            </div>
            <span class="conversation-delete" (click)="deleteThis($event, item)">×</span>
            <span *ngIf="item.shield" class="conversation-shield"></span>
        </li>
    </ul>
</perfect-scrollbar>
<div class="conversation-top-menu" [hidden]="!topPosition.show" [ngStyle]="{'top': topPosition.top + 'px', 'left': topPosition.left + 'px'}">
    <ul>
        <li class="menu-hover" (click)="conversationToTopAction()">{{topPosition.item?.extras?.top_time_ms ? '取消置顶' : '会话置顶'}}</li>
    </ul>
</div>